package Gather.Advanced.哈希值.练习;

import java.util.HashMap;

public class 存储并遍历 {
    public static void main(String[] args) {
        /**
         * 题目:创建一个HashMap集合，键是学生对象（Stubert)，值是籍贯
         * 存储三个键值对元素，并遍历
         * 要求：同姓名，同年龄认为是一个学生
         */
        HashMap<Student,String> hash=new HashMap<>();

        Student stu1=new Student("lisi",23);
        Student stu2=new Student("zhangsan",54);
        Student stu3=new Student("wangwu",33);
        Student stu4=new Student("wangwu",33);

        hash.put(stu1,"meiguo");
        hash.put(stu2,"shangahi");
        hash.put(stu3,"zhongguo");

        hash.forEach((s1,s2)-> System.out.println(s1+"="+s2));


    }
}
